<template>
	<view class="points-management-page">
		<!-- 页面头部 -->
		<view class="page-header">
			<view class="header-left" @click="goBack">
				<text class="back-icon">←</text>
				<text class="back-text">返回</text>
			</view>
			<text class="page-title">积分管理</text>
			<view class="header-right">
				<text class="refresh-btn" @click="refreshData">刷新</text>
			</view>
		</view>

		<!-- 标签页切换 -->
		<view class="tab-section">
			<view class="tab-bar">
				<view
					class="tab-item"
					:class="{ active: activeTab === 'record' }"
					@click="switchTab('record')"
				>
					<text class="tab-text">积分登记</text>
					<view class="tab-count" v-if="recordData.length > 0">{{ recordData.length }}</view>
				</view>
				<view
					class="tab-item"
					:class="{ active: activeTab === 'approval' }"
					@click="switchTab('approval')"
				>
					<text class="tab-text">积分审批</text>
					<view class="tab-count" v-if="approvalData.length > 0">{{ approvalData.length }}</view>
				</view>
			</view>

			<!-- 积分登记标签页 -->
			<view v-if="activeTab === 'record'" class="tab-content">
				<!-- 筛选器和操作 -->
				<view class="filter-section">
					<view class="filter-tabs">
						<view
							class="filter-tab"
							:class="{ active: recordFilter === 'all' }"
							@click="setRecordFilter('all')"
						>
							<text class="tab-text">全部</text>
							<view class="tab-count">{{ recordData.length }}</view>
						</view>
						<view
							class="filter-tab"
							:class="{ active: recordFilter === 'pending' }"
							@click="setRecordFilter('pending')"
						>
							<text class="tab-text">待审批</text>
							<view class="tab-count">{{ getRecordCountByStatus('pending') }}</view>
						</view>
						<view
							class="filter-tab"
							:class="{ active: recordFilter === 'approved' }"
							@click="setRecordFilter('approved')"
						>
							<text class="tab-text">已通过</text>
							<view class="tab-count">{{ getRecordCountByStatus('approved') }}</view>
						</view>
						<view
							class="filter-tab"
							:class="{ active: recordFilter === 'rejected' }"
							@click="setRecordFilter('rejected')"
						>
							<text class="tab-text">已拒绝</text>
							<view class="tab-count">{{ getRecordCountByStatus('rejected') }}</view>
						</view>
					</view>
				</view>

				<!-- 积分记录列表 -->
				<scroll-view class="list-scroll" scroll-y>
					<view class="list-container">
						<view
							v-for="(item, index) in filteredRecordData"
							:key="item.id"
							class="points-card"
							@click="viewRecordDetail(item)"
						>
							<!-- 卡片头部 -->
							<view class="card-header">
								<view class="header-left">
									<text class="record-time">{{ formatTime(item.recordTime) }}</text>
									<view class="status-badge" :class="getStatusClass(item.status)">
										<text class="status-text">{{ getStatusText(item.status) }}</text>
									</view>
								</view>
								<view class="header-right">
									<text class="department-name">{{ item.departmentName }}</text>
								</view>
							</view>

							<!-- 卡片内容 -->
							<view class="card-content">
								<view class="content-row">
									<text class="label">责任人：</text>
									<text class="value">{{ item.responsiblePersonName }}</text>
								</view>
								<view class="content-row">
									<text class="label">事件描述：</text>
									<text class="value description">{{ item.eventDescription }}</text>
								</view>
								<view class="content-row">
									<text class="label">积分：</text>
									<text class="value points-value" :class="item.pointsType === 'add' ? 'points-positive' : 'points-negative'">
										{{ item.pointsType === 'add' ? '+' : '-' }}{{ item.pointsValue }}
									</text>
								</view>
								<view class="content-row">
									<text class="label">记录人：</text>
									<text class="value">{{ item.recorderName }}</text>
								</view>
							</view>

							<!-- 卡片底部 -->
							<view class="card-footer">
								<view class="points-info">
									<text class="info-text">严重程度: {{ getSeverityText(item.severity) }}</text>
									<text class="info-text">地点: {{ item.location }}</text>
								</view>
								<view class="action-buttons">
									<button
										class="action-btn detail-btn"
										@click.stop="viewRecordDetail(item)"
									>
										详情
									</button>
									<button
										v-if="item.status === 'pending'"
										class="action-btn edit-btn"
										@click.stop="editRecord(item)"
									>
										编辑
									</button>
									<button
										v-if="item.status === 'pending'"
										class="action-btn delete-btn"
										@click.stop="deleteRecord(item)"
									>
										删除
									</button>
								</view>
							</view>
						</view>

						<!-- 空状态 -->
						<view v-if="filteredRecordData.length === 0" class="empty-state">
							<text class="empty-icon">⭐</text>
							<text class="empty-text">暂无积分记录</text>
							<button class="create-btn" @click="openCreateDialog">新增积分记录</button>
						</view>
					</view>
				</scroll-view>
			</view>

			<!-- 积分审批标签页 -->
			<view v-if="activeTab === 'approval'" class="tab-content">
				<!-- 筛选器 -->
				<view class="filter-section">
					<view class="filter-tabs">
						<view
							class="filter-tab"
							:class="{ active: approvalFilter === 'all' }"
							@click="setApprovalFilter('all')"
						>
							<text class="tab-text">全部</text>
							<view class="tab-count">{{ approvalData.length }}</view>
						</view>
						<view
							class="filter-tab"
							:class="{ active: approvalFilter === 'pending' }"
							@click="setApprovalFilter('pending')"
						>
							<text class="tab-text">待审批</text>
							<view class="tab-count">{{ getApprovalCountByStatus('pending') }}</view>
						</view>
						<view
							class="filter-tab"
							:class="{ active: approvalFilter === 'approved' }"
							@click="setApprovalFilter('approved')"
						>
							<text class="tab-text">已通过</text>
							<view class="tab-count">{{ getApprovalCountByStatus('approved') }}</view>
						</view>
						<view
							class="filter-tab"
							:class="{ active: approvalFilter === 'rejected' }"
							@click="setApprovalFilter('rejected')"
						>
							<text class="tab-text">已拒绝</text>
							<view class="tab-count">{{ getApprovalCountByStatus('rejected') }}</view>
						</view>
					</view>
				</view>

				<!-- 积分审批列表 -->
				<scroll-view class="list-scroll" scroll-y>
					<view class="list-container">
						<view
							v-for="(item, index) in filteredApprovalData"
							:key="item.id"
							class="points-card"
							@click="viewApprovalDetail(item)"
						>
							<!-- 卡片头部 -->
							<view class="card-header">
								<view class="header-left">
									<text class="record-time">{{ formatTime(item.recordTime) }}</text>
									<view class="status-badge" :class="getApprovalStatusClass(item.status)">
										<text class="status-text">{{ getApprovalStatusText(item.status) }}</text>
									</view>
								</view>
								<view class="header-right">
									<text class="department-name">{{ item.departmentName }}</text>
								</view>
							</view>

							<!-- 卡片内容 -->
							<view class="card-content">
								<view class="content-row">
									<text class="label">责任人：</text>
									<text class="value">{{ item.responsiblePersonName }}</text>
								</view>
								<view class="content-row">
									<text class="label">事件描述：</text>
									<text class="value description">{{ item.eventDescription }}</text>
								</view>
								<view class="content-row">
									<text class="label">积分：</text>
									<text class="value points-value" :class="item.pointsType === 'add' ? 'points-positive' : 'points-negative'">
										{{ item.pointsType === 'add' ? '+' : '-' }}{{ item.pointsValue }}
									</text>
								</view>
								<view class="content-row">
									<text class="label">记录人：</text>
									<text class="value">{{ item.recorderName }}</text>
								</view>
								<view class="content-row" v-if="item.approvalTime">
									<text class="label">审批时间：</text>
									<text class="value">{{ formatDateTime(item.approvalTime) }}</text>
								</view>
								<view class="content-row" v-if="item.approvalComment">
									<text class="label">审批意见：</text>
									<text class="value description">{{ item.approvalComment }}</text>
								</view>
							</view>

							<!-- 卡片底部 -->
							<view class="card-footer">
								<view class="points-info">
									<text class="info-text">严重程度: {{ getSeverityText(item.severity) }}</text>
									<text class="info-text">地点: {{ item.location }}</text>
								</view>
								<view class="action-buttons">
									<button
										class="action-btn detail-btn"
										@click.stop="viewApprovalDetail(item)"
									>
										详情
									</button>
									<button
										v-if="item.status === 'pending'"
										class="action-btn approve-btn"
										@click.stop="approvePoints(item, 'approved')"
									>
										通过
									</button>
									<button
										v-if="item.status === 'pending'"
										class="action-btn reject-btn"
										@click.stop="approvePoints(item, 'rejected')"
									>
										拒绝
									</button>
								</view>
							</view>
						</view>

						<!-- 空状态 -->
						<view v-if="filteredApprovalData.length === 0" class="empty-state">
							<text class="empty-icon">🔍</text>
							<text class="empty-text">暂无待审批的积分记录</text>
						</view>
					</view>
				</scroll-view>
			</view>
		</view>

		<!-- 底部浮动操作按钮 -->
		<view v-if="activeTab === 'record'" class="floating-action">
			<button class="fab-btn" @click="openCreateDialog">
				<text class="fab-icon">➕</text>
			</button>
		</view>

		<!-- 新增积分记录弹窗 -->
		<view v-if="showCreateDialog" class="create-popup-overlay" @click="closeCreateDialog">
			<view class="create-popup" @click.stop>
				<view class="popup-header">
					<text class="popup-title">新增积分记录</text>
					<text class="close-btn" @click="closeCreateDialog">✕</text>
				</view>

				<scroll-view class="popup-scroll" scroll-y>
					<view class="popup-content">
						<view class="form-item">
							<text class="label">部门</text>
							<picker :value="formData.departmentIndex" :range="departmentList" range-key="name" @change="onFormDepartmentChange">
								<view class="picker-view">
									<text class="picker-text">{{ formData.selectedDepartment.name || '请选择部门' }}</text>
									<text class="picker-arrow">▼</text>
								</view>
							</picker>
						</view>

						<view class="form-item">
							<text class="label">责任人</text>
							<input class="input" v-model="formData.responsiblePersonName" placeholder="请输入责任人姓名" />
						</view>

						<view class="form-item">
							<text class="label">事件描述</text>
							<textarea class="textarea" v-model="formData.eventDescription" placeholder="请详细描述积分事件"></textarea>
						</view>

						<view class="form-row">
							<view class="form-item">
								<text class="label">积分类型</text>
								<view class="radio-group">
									<view class="radio-item" @click="formData.pointsType = 'add'">
										<view class="radio" :class="{ 'checked': formData.pointsType === 'add' }">
											<text class="radio-icon" v-if="formData.pointsType === 'add'">●</text>
										</view>
										<text class="radio-text">加分</text>
									</view>
									<view class="radio-item" @click="formData.pointsType = 'deduct'">
										<view class="radio" :class="{ 'checked': formData.pointsType === 'deduct' }">
											<text class="radio-icon" v-if="formData.pointsType === 'deduct'">●</text>
										</view>
										<text class="radio-text">扣分</text>
									</view>
								</view>
							</view>
							<view class="form-item">
								<text class="label">积分分值</text>
								<input class="input" type="number" v-model="formData.pointsValue" placeholder="请输入分值" />
							</view>
						</view>

						<view class="form-item">
							<text class="label">严重程度</text>
							<picker :value="formData.severityIndex" :range="severityList" range-key="label" @change="onSeverityChange">
								<view class="picker-view">
									<text class="picker-text">{{ selectedSeverity.label || '请选择严重程度' }}</text>
									<text class="picker-arrow">▼</text>
								</view>
							</picker>
						</view>

						<view class="form-item">
							<text class="label">地点</text>
							<input class="input" v-model="formData.location" placeholder="请输入事件发生地点" />
						</view>
					</view>
				</scroll-view>

				<view class="popup-actions">
					<button class="btn btn-secondary" @click="closeCreateDialog">取消</button>
					<button class="btn btn-primary" @click="submitForm" :disabled="submitting">
						<text v-if="!submitting">创建</text>
						<text v-else>提交中...</text>
					</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				activeTab: 'record', // 默认显示积分登记
				recordFilter: 'all',
				approvalFilter: 'all',
				showCreateDialog: false,
				submitting: false,
				departmentList: [
					{ id: '1', name: '安全部' },
					{ id: '2', name: '生产部' },
					{ id: '3', name: '维修部' },
					{ id: '4', name: '工程部' },
					{ id: '5', name: '质量部' }
				],
				severityList: [
					{ value: 'low', label: '低' },
					{ value: 'medium', label: '中' },
					{ value: 'high', label: '高' }
				],
				recordData: [
					{
						id: '1',
						recordTime: '2025-01-15 09:30:00',
						departmentName: '安全部',
						responsiblePersonName: '张三',
						eventDescription: '发现员工未佩戴安全帽进入施工现场，及时制止并教育',
						pointsType: 'add',
						pointsValue: 5,
						recorderName: '李四',
						status: 'pending',
						severity: 'medium',
						location: 'A区施工现场'
					},
					{
						id: '2',
						recordTime: '2025-01-15 14:20:00',
						departmentName: '生产部',
						responsiblePersonName: '赵六',
						eventDescription: '主动发现并报告安全隐患，避免事故发生',
						pointsType: 'add',
						pointsValue: 10,
						recorderName: '孙七',
						status: 'approved',
						approvalTime: '2025-01-15 15:00:00',
						approvalComment: '表现优秀，值得表扬',
						severity: 'high',
						location: 'B车间'
					},
					{
						id: '3',
						recordTime: '2025-01-14 16:45:00',
						departmentName: '安全部',
						responsiblePersonName: '周八',
						eventDescription: '未按规定进行安全交底',
						pointsType: 'deduct',
						pointsValue: 3,
						recorderName: '吴九',
						status: 'rejected',
						approvalTime: '2025-01-14 17:00:00',
						approvalComment: '证据不足，需要进一步核实',
						severity: 'low',
						location: 'C区施工现场'
					}
				],
				approvalData: [
					{
						id: '4',
						recordTime: '2025-01-16 09:30:00',
						departmentName: '生产部',
						responsiblePersonName: '郑十',
						eventDescription: '违规操作设备，存在安全隐患',
						pointsType: 'deduct',
						pointsValue: 8,
						recorderName: '冯十一',
						status: 'pending',
						severity: 'high',
						location: 'D车间'
					},
					{
						id: '5',
						recordTime: '2025-01-16 11:15:00',
						departmentName: '工程部',
						responsiblePersonName: '陈十二',
						eventDescription: '积极参与安全培训并获得优秀学员称号',
						pointsType: 'add',
						pointsValue: 15,
						recorderName: '黄十三',
						status: 'pending',
						severity: 'medium',
						location: '培训中心'
					}
				],
				formData: {
					departmentIndex: 0,
					selectedDepartment: {},
					responsiblePersonName: '',
					eventDescription: '',
					pointsType: 'add',
					pointsValue: 1,
					severityIndex: 0,
					location: ''
				}
			}
		},
		computed: {
			filteredRecordData() {
				if (this.recordFilter === 'all') {
					return this.recordData
				}
				return this.recordData.filter(item => item.status === this.recordFilter)
			},
			filteredApprovalData() {
				if (this.approvalFilter === 'all') {
					return this.approvalData
				}
				return this.approvalData.filter(item => item.status === this.approvalFilter)
			},
			selectedSeverity() {
				return this.severityList[this.formData.severityIndex] || {}
			}
		},
		methods: {
			goBack() {
				uni.navigateBack()
			},

			refreshData() {
				uni.showToast({
					title: '刷新成功',
					icon: 'success'
				})
			},

			switchTab(tab) {
				this.activeTab = tab
			},

			setRecordFilter(filter) {
				this.recordFilter = filter
			},

			setApprovalFilter(filter) {
				this.approvalFilter = filter
			},

			// 积分登记相关方法
			getRecordCountByStatus(status) {
				if (status === 'all') return this.recordData.length
				return this.recordData.filter(item => item.status === status).length
			},

			getStatusClass(status) {
				return `status-${status}`
			},

			getStatusText(status) {
				const statusMap = {
					pending: '待审批',
					approved: '已通过',
					rejected: '已拒绝'
				}
				return statusMap[status] || status
			},

			openCreateDialog() {
				this.resetForm()
				this.showCreateDialog = true
			},

			closeCreateDialog() {
				this.showCreateDialog = false
			},

			resetForm() {
				this.formData = {
					departmentIndex: 0,
					selectedDepartment: {},
					responsiblePersonName: '',
					eventDescription: '',
					pointsType: 'add',
					pointsValue: 1,
					severityIndex: 0,
					location: ''
				}
			},

			onFormDepartmentChange(e) {
				this.formData.departmentIndex = e.detail.value
				this.formData.selectedDepartment = this.departmentList[e.detail.value]
			},

			onSeverityChange(e) {
				this.formData.severityIndex = e.detail.value
			},

			async submitForm() {
				if (!this.validateForm()) {
					return
				}

				this.submitting = true

				try {
					// 模拟API调用
					await new Promise(resolve => setTimeout(resolve, 1000))

					const newRecord = {
						id: Date.now().toString(),
						recordTime: new Date().toLocaleString(),
						departmentName: this.formData.selectedDepartment.name,
						responsiblePersonName: this.formData.responsiblePersonName,
						eventDescription: this.formData.eventDescription,
						pointsType: this.formData.pointsType,
						pointsValue: this.formData.pointsValue,
						recorderName: '当前用户',
						status: 'pending',
						severity: this.selectedSeverity.value,
						location: this.formData.location
					}

					this.recordData.unshift(newRecord)
					this.closeCreateDialog()

					uni.showToast({
						title: '创建成功',
						icon: 'success'
					})
				} catch (error) {
					uni.showToast({
						title: '创建失败',
						icon: 'none'
					})
				} finally {
					this.submitting = false
				}
			},

			validateForm() {
				if (!this.formData.selectedDepartment.id) {
					uni.showToast({
						title: '请选择部门',
						icon: 'none'
					})
					return false
				}

				if (!this.formData.responsiblePersonName.trim()) {
					uni.showToast({
						title: '请输入责任人姓名',
						icon: 'none'
					})
					return false
				}

				if (!this.formData.eventDescription.trim()) {
					uni.showToast({
						title: '请输入事件描述',
						icon: 'none'
					})
					return false
				}

				if (!this.formData.pointsValue || this.formData.pointsValue <= 0) {
					uni.showToast({
						title: '请输入有效的积分分值',
						icon: 'none'
					})
					return false
				}

				return true
			},

			viewRecordDetail(item) {
				uni.showToast({
					title: `查看记录详情: ${item.id}`,
					icon: 'none'
				})
			},

			editRecord(item) {
				uni.showToast({
					title: '编辑功能开发中',
					icon: 'none'
				})
			},

			deleteRecord(item) {
				uni.showModal({
					title: '确认删除',
					content: '确定要删除这条积分记录吗？',
					success: (res) => {
						if (res.confirm) {
							const index = this.recordData.findIndex(r => r.id === item.id)
							if (index > -1) {
								this.recordData.splice(index, 1)
								uni.showToast({
									title: '删除成功',
									icon: 'success'
								})
							}
						}
					}
				})
			},

			// 积分审批相关方法
			getApprovalCountByStatus(status) {
				if (status === 'all') return this.approvalData.length
				return this.approvalData.filter(item => item.status === status).length
			},

			getApprovalStatusClass(status) {
				return `status-${status}`
			},

			getApprovalStatusText(status) {
				const statusMap = {
					pending: '待审批',
					approved: '已通过',
					rejected: '已拒绝'
				}
				return statusMap[status] || status
			},

			viewApprovalDetail(item) {
				uni.showToast({
					title: `查看审批详情: ${item.id}`,
					icon: 'none'
				})
			},

			approvePoints(item, action) {
				const actionText = action === 'approved' ? '通过' : '拒绝'
				uni.showModal({
					title: `${actionText}积分审批`,
					content: `确定要${actionText}这条积分记录吗？`,
					success: (res) => {
						if (res.confirm) {
							item.status = action
							item.approvalTime = new Date().toLocaleString()
							item.approvalComment = action === 'approved' ? '审批通过' : '审批拒绝'

							// 从审批列表移除，添加到记录列表
							const index = this.approvalData.findIndex(a => a.id === item.id)
							if (index > -1) {
								this.approvalData.splice(index, 1)
								this.recordData.unshift(item)
							}

							uni.showToast({
								title: `${actionText}成功`,
								icon: 'success'
							})
						}
					}
				})
			},

			// 通用方法
			getSeverityText(severity) {
				const severityMap = {
					low: '低',
					medium: '中',
					high: '高'
				}
				return severityMap[severity] || severity
			},

			formatTime(time) {
				return time.split(' ')[0]
			},

			formatDateTime(time) {
				const date = new Date(time)
				const month = (date.getMonth() + 1).toString().padStart(2, '0')
				const day = date.getDate().toString().padStart(2, '0')
				const hours = date.getHours().toString().padStart(2, '0')
				const minutes = date.getMinutes().toString().padStart(2, '0')
				return `${month}-${day} ${hours}:${minutes}`
			}
		}
	}
</script>

<style lang="scss" scoped>
	.points-management-page {
		background: #f8f9fa;
		min-height: 100vh;
		display: flex;
		flex-direction: column;
	}

	.page-header {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 20rpx 30rpx;
		background: #fff;
		border-bottom: 1rpx solid #e4e7ed;

		.header-left {
			display: flex;
			align-items: center;

			.back-icon {
				font-size: 36rpx;
				margin-right: 10rpx;
				color: #409EFF;
			}

			.back-text {
				font-size: 28rpx;
				color: #409EFF;
			}
		}

		.page-title {
			font-size: 32rpx;
			font-weight: bold;
			color: #333;
		}

		.header-right {
			.refresh-btn {
				font-size: 28rpx;
				color: #409EFF;
			}
		}
	}

	.tab-section {
		flex: 1;
		display: flex;
		flex-direction: column;

		.tab-bar {
			display: flex;
			background: #fff;
			border-bottom: 1rpx solid #e4e7ed;

			.tab-item {
				flex: 1;
				position: relative;
				display: flex;
				align-items: center;
				justify-content: center;
				padding: 30rpx 20rpx;
				cursor: pointer;
				transition: all 0.3s ease;

				&.active {
					border-bottom: 4rpx solid #409EFF;

					.tab-text {
						color: #409EFF;
						font-weight: bold;
					}
				}

				.tab-text {
					font-size: 28rpx;
					color: #666;
				}

				.tab-count {
					margin-left: 8rpx;
					background: #e4e7ed;
					color: #666;
					border-radius: 12rpx;
					padding: 4rpx 10rpx;
					font-size: 20rpx;
					min-width: 28rpx;
					text-align: center;
				}
			}
		}

		.tab-content {
			flex: 1;
			overflow: hidden;
		}
	}

	.filter-section {
		background: #fff;
		padding: 20rpx 30rpx;
		border-bottom: 1rpx solid #e4e7ed;

		.filter-tabs {
			display: flex;
			gap: 16rpx;
			flex-wrap: wrap;

			.filter-tab {
				position: relative;
				padding: 16rpx 20rpx;
				border-radius: 24rpx;
				background: #f5f5f5;
				display: flex;
				align-items: center;
				gap: 8rpx;
				transition: all 0.3s ease;

				&.active {
					background: #409EFF;

					.tab-text {
						color: #fff;
					}

					.tab-count {
						background: rgba(255, 255, 255, 0.3);
						color: #fff;
					}
				}

				.tab-text {
					font-size: 26rpx;
					color: #666;
					font-weight: 500;
				}

				.tab-count {
					background: #e4e7ed;
					color: #666;
					border-radius: 12rpx;
					padding: 4rpx 10rpx;
					font-size: 20rpx;
					min-width: 28rpx;
					text-align: center;
				}
			}
		}
	}

	.floating-action {
		position: fixed;
		bottom: 60rpx;
		right: 40rpx;
		z-index: 100;

		.fab-btn {
			width: 112rpx;
			height: 112rpx;
			border-radius: 50%;
			background: linear-gradient(135deg, #409EFF, #5cadff);
			border: none;
			display: flex;
			align-items: center;
			justify-content: center;
			box-shadow: 0 8rpx 24rpx rgba(64, 158, 255, 0.4);
			transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

			&:active {
				transform: scale(0.9);
				box-shadow: 0 4rpx 12rpx rgba(64, 158, 255, 0.6);
			}

			.fab-icon {
				font-size: 48rpx;
				color: #fff;
				font-weight: bold;
				text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.2);
			}
		}
	}

	/* 移动端适配 */
	@media (max-width: 750rpx) {
		.floating-action {
			bottom: 80rpx;
			right: 30rpx;

			.fab-btn {
				width: 96rpx;
				height: 96rpx;

				.fab-icon {
					font-size: 42rpx;
				}
			}
		}
	}

	.list-scroll {
		flex: 1;
	}

	.list-container {
		padding: 20rpx;

		.points-card {
			background: #fff;
			border-radius: 16rpx;
			margin-bottom: 20rpx;
			box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
			overflow: hidden;
			transition: all 0.3s ease;

			&:active {
				transform: scale(0.98);
			}

			.card-header {
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 24rpx 30rpx 16rpx;
				border-bottom: 1rpx solid #f0f0f0;

				.header-left {
					display: flex;
					align-items: center;
					gap: 16rpx;

					.record-time {
						font-size: 32rpx;
						font-weight: bold;
						color: #409EFF;
					}

					.status-badge {
						padding: 8rpx 16rpx;
						border-radius: 12rpx;
						font-size: 22rpx;

						&.status-pending {
							background: #fff7e6;
							color: #fa8c16;
						}

						&.status-approved {
							background: #f6ffed;
							color: #52c41a;
						}

						&.status-rejected {
							background: #fff2f0;
							color: #ff4d4f;
						}

						.status-text {
							font-weight: 500;
						}
					}
				}

				.header-right {
					.department-name {
						font-size: 24rpx;
						color: #999;
					}
				}
			}

			.card-content {
				padding: 20rpx 30rpx;

				.content-row {
					display: flex;
					margin-bottom: 16rpx;

					&:last-child {
						margin-bottom: 0;
					}

					.label {
						font-size: 28rpx;
						color: #666;
						min-width: 160rpx;
					}

					.value {
						font-size: 28rpx;
						color: #333;
						flex: 1;

						&.description {
							line-height: 1.4;
							overflow: hidden;
							text-overflow: ellipsis;
							display: -webkit-box;
							-webkit-line-clamp: 2;
							-webkit-box-orient: vertical;
						}

						&.points-value {
							font-weight: bold;
							font-size: 32rpx;

							&.points-positive {
								color: #52c41a;
							}

							&.points-negative {
								color: #ff4d4f;
							}
						}
					}
				}
			}

			.card-footer {
				padding: 20rpx 30rpx 24rpx;
				border-top: 1rpx solid #f0f0f0;
				display: flex;
				justify-content: space-between;
				align-items: center;

				.points-info {
					display: flex;
					flex-direction: column;
					gap: 8rpx;

					.info-text {
						font-size: 24rpx;
						color: #999;
					}
				}

				.action-buttons {
					display: flex;
					gap: 12rpx;

					.action-btn {
						padding: 10rpx 20rpx;
						border-radius: 20rpx;
						font-size: 22rpx;
						border: none;

						&.detail-btn {
							background: #f0f0f0;
							color: #666;
						}

						&.edit-btn {
							background: #e6a23c;
							color: #fff;
						}

						&.delete-btn {
							background: #f56c6c;
							color: #fff;
						}

						&.approve-btn {
							background: #52c41a;
							color: #fff;
						}

						&.reject-btn {
							background: #ff4d4f;
							color: #fff;
						}
					}
				}
			}
		}

		.empty-state {
			text-align: center;
			padding: 120rpx 0;

			.empty-icon {
				font-size: 120rpx;
				margin-bottom: 20rpx;
			}

			.empty-text {
				font-size: 32rpx;
				color: #666;
				margin-bottom: 16rpx;
			}

			.create-btn {
				background: #409EFF;
				color: #fff;
				border: none;
				padding: 20rpx 40rpx;
				border-radius: 24rpx;
				font-size: 28rpx;
			}
		}
	}

	.create-popup-overlay {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background: rgba(0, 0, 0, 0.5);
		display: flex;
		align-items: flex-end;
		z-index: 1000;
	}

	.create-popup {
		background: #fff;
		border-radius: 20rpx 20rpx 0 0;
		max-height: 80vh;
		width: 100%;

		.popup-header {
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 30rpx;
			border-bottom: 1rpx solid #e4e7ed;

			.popup-title {
				font-size: 32rpx;
				font-weight: bold;
				color: #333;
			}

			.close-btn {
				font-size: 36rpx;
				color: #999;
			}
		}

		.popup-scroll {
			max-height: 60vh;
		}

		.popup-content {
			padding: 30rpx;

			.form-item {
				margin-bottom: 30rpx;

				.label {
					display: block;
					font-size: 28rpx;
					color: #333;
					margin-bottom: 15rpx;
					font-weight: 500;
				}

				.input {
					width: 100%;
					height: 80rpx;
					border: 2rpx solid #e4e7ed;
					border-radius: 8rpx;
					padding: 0 20rpx;
					font-size: 28rpx;
					background: #fff;
					box-sizing: border-box;
				}

				.textarea {
					width: 100%;
					min-height: 120rpx;
					border: 2rpx solid #e4e7ed;
					border-radius: 8rpx;
					padding: 20rpx;
					font-size: 28rpx;
					background: #fff;
					box-sizing: border-box;
				}

				.picker-view {
					display: flex;
					align-items: center;
					justify-content: space-between;
					height: 80rpx;
					border: 2rpx solid #e4e7ed;
					border-radius: 8rpx;
					padding: 0 20rpx;
					background: #fff;

					.picker-text {
						font-size: 28rpx;
						color: #333;
					}

					.picker-arrow {
						font-size: 24rpx;
						color: #999;
					}
				}

				.form-row {
					display: flex;

					.form-item {
						flex: 1;
						margin-right: 30rpx;

						&:last-child {
							margin-right: 0;
						}
					}
				}

				.radio-group {
					display: flex;
					gap: 40rpx;

					.radio-item {
						display: flex;
						align-items: center;

						.radio {
							width: 40rpx;
							height: 40rpx;
							border: 2rpx solid #e4e7ed;
							border-radius: 50%;
							margin-right: 15rpx;
							display: flex;
							align-items: center;
							justify-content: center;

							&.checked {
								border-color: #409EFF;

								.radio-icon {
									color: #409EFF;
									font-size: 20rpx;
								}
							}
						}

						.radio-text {
							font-size: 28rpx;
							color: #333;
						}
					}
				}
			}
		}

		.popup-actions {
			display: flex;
			gap: 20rpx;
			padding: 30rpx;

			.btn {
				flex: 1;
				height: 80rpx;
				border-radius: 12rpx;
				font-size: 32rpx;
				font-weight: bold;
				border: none;

				&.btn-secondary {
					background: #f0f0f0;
					color: #666;
				}

				&.btn-primary {
					background: #409EFF;
					color: #fff;

					&:disabled {
						opacity: 0.6;
					}
				}
			}
		}
	}
</style>
